﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using CMS.Core.DataInterfaces;
using CMS.Core.Domain;
using CMS.Data;
using CMS.Presenters;

namespace CMS.Web.Lookups
{
    public partial class MenuNav : BaseUserControl, IMenuView
    {
        //public int _TabId = 0;
        MenuPresenter presenter;
        IChucNangDao iChucNangDao;
        public IList menu;
        //public IList<ChucNang> functions;
        public NguoiSuDungInfo userInfo = null;

        protected void Page_Load(object sender, EventArgs e)
        {
            iChucNangDao = NHibernateDaoFactory.Instance.GetChucNangDao();
            this.presenter = new MenuPresenter(this, iChucNangDao);
            
            userInfo = (NguoiSuDungInfo)Session["UserInfo"];
            if (userInfo != null)
            {
                //if (Request.QueryString.Get("tabID") != null)
                //    _TabId = Int32.Parse(Request.QueryString.Get("tabID"));
                //else
                //    _TabId = userInfo.TabMacDinh;

                menu = userInfo.ChucNang;
                //ArrayList arrList = (ArrayList)menu[_TabId];
                //functions = (IList<ChucNang>)arrList[1];
            }
            //else// menu dien rong
            //{
            //    menu = presenter.GetAllViews();
            //}
        }
    }
}